package com.coursehub.shared.config;

import com.coursehub.shared.transaction.DistributedTransactionManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 分布式事务配置类
 */
@Slf4j
@Configuration
public class TransactionConfig {
    
    /**
     * 配置分布式事务管理器
     */
    @Bean
    @ConditionalOnMissingBean
    public DistributedTransactionManager distributedTransactionManager() {
        log.info("初始化分布式事务管理器");
        return new DistributedTransactionManager();
    }
}